package cn.le.releaseSub;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 项目名  spring-boot
 * Created by lansp
 * Created at 2018/6/1
 * 描述:
 */
@Configuration
public class SubConfig {

	@Bean
	public Queue aMessage(){
		return new Queue("fanout.A");
	}
	@Bean
	public Queue bMessage(){
		return new Queue("fanout.B");
	}
	@Bean
	public Queue cMessage(){
		return new Queue("fanout.C");
	}

	//配置交换机
	@Bean
	public FanoutExchange fanoutExchange(){
		return new FanoutExchange("fanoutExchange");
	}

	@Bean
	public Binding bindingExchangeA(FanoutExchange fanoutExchange){
		return BindingBuilder.bind(aMessage()).to(fanoutExchange);
	}
	@Bean
	public Binding bindingExcehangeB(FanoutExchange fanoutExchange){
		return BindingBuilder.bind(bMessage()).to(fanoutExchange);
	}
	@Bean
	public Binding bindingExcehangeC(FanoutExchange fanoutExchange){
		return BindingBuilder.bind(cMessage()).to(fanoutExchange);
	}
}














